package com.example.login.Mapper;

import com.example.login.Pojo.Sales;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface SalesMap {
    @Insert("insert into xtshop_sales(starttime,endtime,saletype,first_account,last_account) " +
            "values(#{starttime},#{endtime},#{saletype},#{first_account},#{last_account})")
    void insertSale(String starttime,String endtime,int saletype,float first_account,int last_account);
    @Insert("insert into xtshop_enjoysale(goods_id,sale_id,goods_name,store_name) " +
            "values(#{goods_id},#{sale_id},#{goods_name},#{store_name})")
    void join(int goods_id,int sale_id,String goods_name,String store_name);
    @Select("select sale_id from xtshop_enjoysale where goods_id=#{goods_id}")
    int getSaleIdByGoodsId(int goods_id);
    @Select("select * from xtshop_sales where id=#{id}")
    Sales getSaleById(int id);
}
